<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width,minimum-scale=1.0" name="viewport" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link type="text/css" href="${pageContext.request.contextPath }/css/order.css" rel="stylesheet" />
    <title></title>
    
    <style type="text/css">
    	ul li span{width: 33.33%}
    	ul li span.price{text-align: right;color: #f90}
    </style>
</head>
<body>
    <form id="form">

        <div class="rankbox jifenbox" id="jifenbox">
            <div class="jifenbg" runat="server" id="zongfen">
                订单记录
            </div>
            <ul id="content">
            	<li><span><strong style="color:#7e4c3c">日期</strong></span><span><strong style="color:#7e4c3c">地点</strong></span><span class="price"><strong style="color:#7e4c3c">价格</strong></span></li>
            </ul>
        </div>
    </form>
</body>
</html>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-1.8.2.js"></script>
<script type="text/javascript">

	$(function(){
		$.get("${pageContext.request.contextPath }/order/getOrderByDriver",function(resp){
			for(var i=0;i<resp.length;i++){
				var _html = "";
				_html = "<li><span>date_key</span><span>gasstation_name</span><span class='price'>total_price</span></li>";
				var a = _html.replace("date_key", getFormatDateByLong(resp[i].date_key, "yyyy-MM-dd"));
				var b = a.replace("gasstation_name", resp[i].gasstation_name);
				var c = b.replace("total_price", resp[i].total_price);
				$("#content").append(c);
			}
		});
	});
	
</script>

<script language="javascript">        
    Date.prototype.format = function (format) {  
        var o = {  
            "M+": this.getMonth() + 1,  
            "d+": this.getDate(),  
            "h+": this.getHours(),  
            "m+": this.getMinutes(),  
            "s+": this.getSeconds(),  
            "q+": Math.floor((this.getMonth() + 3) / 3),  
            "S": this.getMilliseconds()  
        }  
        if (/(y+)/.test(format)) {  
            format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));  
        }  
        for (var k in o) {  
            if (new RegExp("(" + k + ")").test(format)) {  
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));  
            }  
        }  
        return format;  
    }    
    function getFormatDateByLong(l, pattern) {  
        return getFormatDate(new Date(l), pattern);  
    }     
    function getFormatDate(date, pattern) {  
        if (date == undefined) {  
            date = new Date();  
        }  
        if (pattern == undefined) {  
            pattern = "yyyy-MM-dd hh:mm:ss";  
        }  
        return date.format(pattern);  
    }       
//    alert(getFormatDateByLong(1279829423000, "yyyy-MM-dd"));  
      
</script> 